<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理系统</title>
    <link rel="stylesheet" href="/static/admin/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/common.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    {include file="common/top"}
    {include file="common/left"}
</div>
<div class="main-container">
    <!-- 面包屑 -->
    <!-- lay-separator="-" -->
    <span class="layui-breadcrumb" lay-separator="-">
            <a href="/admin/index/index">首页</a>
            <a href="#">订单列表</a>
        </span>
    <table class="layui-table" style="margin-top:0px">
        <thead>
        <th style="text-align: center">订单号</th>
        <th style="text-align: center">用户名</th>
        <th style="text-align: center">订单信息</th>
        <th style="text-align: center">总价格</th>
        <th>是否发货</th>
        </thead>
        <tbody>
        {volist name="$orders" id="o"}
        <tr>
            <td style="text-align: center">{$o.order_id}</td>
            <td style="text-align: center">{$o.name}</td>
            <td style="text-align: center">{$o.order_text}</td>
            <td style="text-align: center">{$o.total_price}</td>
            {if $o.is_send==1}
            <td>已发货</td>
            {else}
            <td><input type="hidden" value="{$o.id}"><a class="layui-btn layui-bg-blue layui-icon layui-icon-flag" onclick="sendgoods(this)">发货</a></td>
            {/if}
        </tr>
        {/volist}
        </tbody>
    </table>
    <div style="width: 100%;text-align: center">{$orders->render()|raw}</div>
</div>
</body>
<script src="/static/admin/layui/layui.js"></script>
<script src="/static/admin/js/jquery-3.0.0.js"></script>
<script>
    layui.use(['element'],() =>{
    });

    function sendgoods(_this) {
        $.ajax({
            url:'sendgoodsajax',
            type:'post',
            data:{
                id:$(_this).siblings('input').val()
            },
            success:function (res) {
                if (res==1){
                    $(_this).parent().html('已发货');
                }
            }
        })
    }
</script>
<!-- <script src="../layui/layui.all.js"></script>
<script>
    window.onload = () => {
        layui.layer.msg('Hello Layui!');
    }
</script> -->
</html>